package com.zpark;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Servlet生命周期
 */
public class Demo03Servlet extends HttpServlet {
	/*
	 * service方法。当用户访问资源的时候被调用
	 */
	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		System.out.println("service...");
	}

	/*
		Servlet销毁方法。默认容器停止时销毁
	 */
	@Override
	public void destroy() {
		System.out.println("Servlet被销毁");
	}

	/*
	* Servlet初始化方法。默认容器启动的时候被调用
	 */
	@Override
	public void init() throws ServletException {
		System.out.println("Demo03Servlet被初始化");
	}
}
